
Page({
  data: {
    doing:[{value:'张祥',check:false},{value:"dick",check:false}],
    completed:[],
    false:false
  },
  getInput(e){
     var value = e.detail.value;
     var obj = {};
     obj.value = value;
     obj.check = false;
     let arr = this.data.doing;
     arr.push(obj);
     this.setData({
        doing:arr
     });

  },
  del(e){
     console.log(e);
     var {index} = e.currentTarget.dataset;
     console.log(index);
     let arr = this.data.doing;
     arr.splice(index,1);
     this.setData({
        doing:arr
     })
  },
   del1(e) {
      var { index } = e.currentTarget.dataset;
      let arr = this.data.completed;
      arr.splice(index, 1);
      this.setData({
         completed: arr
      })
   },
   todo(e){
      console.log(e);
      var {item,index} = e.currentTarget.dataset;
      let arr = this.data.doing;
      arr.splice(index,1);
      this.setData({
         doing:arr
      })
      let temp = this.data.completed;
      var obj = {};
      obj.value = item.value;
      obj.check = true;
      temp.push(obj)
      this.setData({
         completed:temp
      })
   },
   redo(e){
      var {item,index} = e.currentTarget.dataset;
      let arr = this.data.completed;
      arr.splice(index,1);
      this.setData({
         completed:arr
      })
      let temp = this.data.doing;
      var obj = {};
      obj.value = item.value;
      obj.check = false;
      temp.push(obj);
      this.setData({
         doing:temp
      })
   }
})
